namespace SmartSoft.ADP
{
    using System;
    using System.Data;
    using System.Data.SqlClient;

    public class ReportDeclarationDataAccess
    {
        private WSReportDeclarationDataAccess.WSReportDeclarationDataAccess wDataAcess = new WSReportDeclarationDataAccess.WSReportDeclarationDataAccess();
        private SmartSoft.DAL.ReportDeclarationDataAccess oDataAcess = new SmartSoft.DAL.ReportDeclarationDataAccess();

        public ReportDeclarationDataAccess()
        {
            wDataAcess.Url = wDataAcess.Url.Replace("localhost", AdapterInstance.ServerIp);
        }

        public DataSet KQT01GetDataSet()
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT01GetDataSet();
            }
            else
            {
                return oDataAcess.KQT01GetDataSet();
            }
        }

        public int KQT01Save(bool pb_NewChecked, DataRow row)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT01Save(pb_NewChecked, SmartSoft.DAL.SSDataAccess.ConvertRowToTable(row));
            }
            else
            {
                return oDataAcess.KQT01Save(pb_NewChecked, row);
            }
        }

        public DataSet KQT02GetDataSet()
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT02GetDataSet();
            }
            else
            {
                return oDataAcess.KQT02GetDataSet();
            }
        }

        public int KQT02Save(bool pb_NewChecked, DataRow row)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT02Save(pb_NewChecked, SmartSoft.DAL.SSDataAccess.ConvertRowToTable(row));
            }
            else
            {
                return oDataAcess.KQT02Save(pb_NewChecked, row);
            }
        }

        public DataSet KQT031GetDataSet()
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT031GetDataSet();
            }
            else
            {
                return oDataAcess.KQT031GetDataSet();
            }
        }

        public int KQT031Save(bool pb_NewChecked, DataRow row)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT031Save(pb_NewChecked, SmartSoft.DAL.SSDataAccess.ConvertRowToTable(row));
            }
            else
            {
                return oDataAcess.KQT031Save(pb_NewChecked, row);
            }
        }

        public DataSet KQT032GetDataSet()
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT032GetDataSet();
            }
            else
            {
                return oDataAcess.KQT032GetDataSet();
            }
        }

        public int KQT032Save(bool pb_NewChecked, DataRow row)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT032Save(pb_NewChecked, SmartSoft.DAL.SSDataAccess.ConvertRowToTable(row));
            }
            else
            {
                return oDataAcess.KQT032Save(pb_NewChecked, row);
            }
        }

        public DataSet KQT05GetDataSet()
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT05GetDataSet();
            }
            else
            {
                return oDataAcess.KQT05GetDataSet();
            }
        }

        public int KQT05Save(bool pb_NewChecked, DataRow row)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                return wDataAcess.KQT05Save(pb_NewChecked, SmartSoft.DAL.SSDataAccess.ConvertRowToTable(row));
            }
            else
            {
                return oDataAcess.KQT05Save(pb_NewChecked, row);
            }
        }
    }
}

